//
//  RMPTypes.h
//  rmplayer
//
//  Created by jelin on 2023/10/4.
//

#ifndef RMPTypes_H
#define RMPTypes_H

#import "RMPNetPlayerConfig.h"

#pragma mark - ap link

typedef NS_ENUM(NSInteger, RMPAPLinkStatus) {
    RMPAPLinkStatus_Disconnected = 0,
    RMPAPLinkStatus_Connected,
    RMPAPLinkStatus_Standby,
    RMPAPLinkStatus_Unknow
};

typedef NS_ENUM(NSInteger, RMPAPLinkRecordType) {
    RMPAPLinkRecord_TypePlanRecord = 1,
    RMPAPLinkRecord_TypeAlarmRecord,
    RMPAPLinkRecord_TypeAllRecord,
};


#pragma mark - 日志级别

typedef NS_ENUM(NSInteger, RMPLogLevel) {
    RMPLogLevel_Verbose  = 1,    //详细级别
    RMPLogLevel_Debug    = 2,    //调试级别
    RMPLogLevel_Info     = 3,    //提示级别
    RMPLogLevel_Warn     = 4,    //告警级别
    RMPLogLevel_Error    = 5,    //错误级别
};


#pragma mark - 播放器回调

typedef NS_ENUM(NSInteger, RMPlayerErrorType) {
    RMPlayerErrorType_NoError = 0,
    RMPlayerErrorType_StreamError,
    RMPlayerErrorType_AuthError,
    RMPlayerErrorType_DecoderError,
    RMPlayerErrorType_InternalError,
};

typedef NS_ENUM(NSInteger, RMPlayerErrorCode) {
    RMPlayerErrorCode_Success = 0,
    //stream code
    RMPlayerErrorCode_PlayStreamConnectError = 1,
    RMPlayerErrorCode_PlayStreamDisconnect,
    RMPlayerErrorCode_TalkStreamConnectError,
    RMPlayerErrorCode_TalkStreamDisconnect,
    RMPlayerErrorCode_OssDownloadError,
    RMPlayerErrorCode_DevicePlayRespError,
    RMPlayerErrorCode_DevicePlayTimeout,
    RMPlayerErrorCode_DeviceOfflineError,
    RMPlayerErrorCode_AppTokenError,
    RMPlayerErrorCode_DevicePlayReqError,
    RMPlayerErrorCode_DeviceNoTFCard,
    RMPlayerErrorCode_DeviceInWeChatCall,

    //decoder code
    RMPlayerErrorCode_DecoderNotInitialized = 100,
    RMPlayerErrorCode_DecoderParamError,
    RMPlayerErrorCode_DecoderDecodeError,
    RMPlayerErrorCode_DecoderFallbackSoftware,

    RMPlayerErrorCode_CreateSdpError = 200,
    RMPlayerErrorCode_SetSdpError,
};

typedef NS_ENUM(NSInteger, RMPlayerState) {
    RMPlayerState_PlayerInited = 1,
    RMPlayerState_PlayerStarted,
    RMPlayerState_PlayerPaused,
    RMPlayerState_PlayerStoped,
    RMPlayerState_PlayerReleased,

    RMPlayerState_PlayerBuffering = 10,
};

typedef NS_ENUM(NSInteger, RMPlayerRecordingError) {
    RMPlayerRecordingError_RecordingMuxerInitError = 1, //recording failed
    RMPlayerRecordingError_RecordingMuxerFinishError,   //recording failed
    RMPlayerRecordingError_RecordingWritePacketError,
};

typedef NS_ENUM(NSInteger, RMPlayerSnapshotResult) {
    RMPlayerSnapshotResult_SnapshotUnknown = 0,
    RMPlayerSnapshotResult_SnapshotOk,
    RMPlayerSnapshotResult_SnapshotWriteFileError,
    RMPlayerSnapshotResult_SnapshotCompressError,
};

typedef NS_ENUM(NSInteger, RMPlayerTalkState) {
    RMPlayerTalkState_FailDeviceInTalking = -100,
    RMPlayerTalkState_FailDeviceRespError,
    RMPlayerTalkState_FailRequestTimeout,
    RMPlayerTalkState_FailDisconnect,

    RMPlayerTalkState_Unknown = 0,
    RMPlayerTalkState_Started,
    RMPlayerTalkState_Ended,

    RMPlayerTalkState_DeviceWaitingAnswer,
    RMPlayerTalkState_DeviceNoAnswer,
    RMPlayerTalkState_DeviceRefuseAnswer,
    RMPlayerTalkState_DeviceHangUp,
    RMPlayerTalkState_DeviceAnswered,
};

typedef NS_ENUM(NSInteger, RMPlayerBufferState) {
    RMPlayerBufferState_Loading = 1,
    RMPlayerBufferState_Ready,
};


#pragma mark - 云存播放模式

typedef NS_ENUM(NSInteger, RMPNetCloudVodPlayMode) {
    RMPNetCloudVodPlayMode_All      = 0,
    RMPNetCloudVodPlayMode_Normal,
    RMPNetCloudVodPlayMode_Preroll,
};


#pragma mark - 区域/环境

typedef NS_ENUM(NSInteger, RMPConfigRegion) {
    RMPConfigRegion_cn = 0,
    RMPConfigRegion_us,
    RMPConfigRegion_us_aws,
    RMPConfigRegion_jp_aws,
    RMPConfigRegion_max,
};

typedef NS_ENUM(NSInteger, RMPConfigEnv) {
    RMPConfigEnv_dev = 0,
    RMPConfigEnv_test,
    RMPConfigEnv_pre,
    RMPConfigEnv_prod,
    RMPConfigEnv_max,
};

typedef NS_ENUM(NSInteger, RMPNetCloudVodDownloaderError) {
    RMPNetCloudVodDownloader_Timeout = 1,
    RMPNetCloudVodDownloader_Failed,
    RMPNetCloudVodDownloader_LoadSourceError,
    RMPNetCloudVodDownloader_InvalidToken,
};

#pragma mark - 数据通道

typedef NS_ENUM(NSInteger, RMPNetDataChannelError) {
    RMPNetDataChannelError_Timeout = 1,
};

typedef void (^RMPNetResponse)(NSString *payload);
typedef void (^RMPNetRequestStatus)(RMPNetDataChannelError code, NSString *desc);

#pragma mark - 手机摄像头方向

typedef NS_ENUM(NSInteger, RMPCameraPosition) {
    RMPCameraPositionBack        = 1, //后置
    RMPCameraPositionFront       = 2, //前置
};

#endif //RMPTypes_H
